package cn.cqs.redisitem.collection;

import java.util.LinkedList;

/**
 * @discription :
 * @author: cqs
 * @date: 2020-09-13 10:54
 */
public class IteratorMain {
    public static void main(String[] args) {
        int size=1000000;
        LinkedList<Object> lists = new LinkedList<>();
        for (int i=0;i<size;i++){
            lists.add(i);
        }
        Long beginTime= System.currentTimeMillis();
        for (int i=0;i< lists.size();i++){
            lists.get(i);
        }
        Long endTime=System.currentTimeMillis();
        System.out.println("for循环时间："+(endTime-beginTime));


//        Long beginTime1= System.currentTimeMillis();
//        Iterator iterator= lists.listIterator();
//        while (iterator.hasNext()){
//            iterator.next();
//        }
//        Long endTime1=System.currentTimeMillis();
//        System.out.println("listIterator时间："+(endTime1-beginTime1));

    }
}
